blob: bef87c4fb08d0e9b6e9fe179f94fae2ef37ba4f2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import { secret } from '@/lib/crypto';
import { createToken } from '@/lib/jwt';
import { json, notFound } from '@/lib/response';
import { getSharedWebsite } from '@/queries/prisma';
export async function GET(_request: Request, { params }: { params: Promise<{ shareId: string }> }) {
const { shareId } = await params;
const website = await getSharedWebsite(shareId);
if (!website) {
return notFound();
}
const data = { websiteId: website.id };
const token = createToken(data, secret());
return json({ ...data, token });
}
|